package com.chenglai.order.mqConfig;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @author yawang
 * @create 2023/11/28 09:28:22
 * 定义消息队列
 **/
@Configuration
public class MqConfig {

    private static final String QUEUE = "orderQueue";
    private static final String EXCHANGE="orderExchange";

    @Bean
    public Queue orderQueue(){
        return new Queue(QUEUE);
    }

    @Bean
    public TopicExchange orderExchange(){
        return new TopicExchange(EXCHANGE);
    }

    @Bean
    public Binding orderBind(){
        return BindingBuilder.bind(orderQueue()).to(orderExchange()).with("orderMessage");
    }
}
